public class Num2283 {
    public boolean digitCount(String num) {
        int[] arr = new int[10];
        char[] chars = num.toCharArray();
        for (char c : chars) {
            int n = c - '0';
            arr[n]++;
        }
        for (int i = 0; i < chars.length; i++) {
            if (chars[i] - '0' != arr[i]) return false;
        }
        return true;
    }
}
